﻿using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    /// <summary>
    /// TeamBO class
    /// </summary>
    public static class TeamBO
    {
        private static readonly TeamDao Dao = new TeamDao();

        /// <summary>
        /// Gets the team.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">Start index of the row.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns></returns>
        public static IQueryable<Team> GetTeam(TeamFilter filter, string sortType, int startRowIndex, int maxRows)
        {
            return Dao.GetList(filter, sortType, startRowIndex, maxRows);
        }

        /// <summary>
        /// Gets the team count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetTeamCount(TeamFilter filter)
        {
            return Dao.GetListCount(filter);
        }

        /// <summary>
        /// Adds the team.
        /// </summary>
        /// <param name="team">The team.</param>
        /// <returns></returns>
        public static bool AddTeam(Team team)
        {
            return Dao.AddTeam(team);
        }

        /// <summary>
        /// Edits the team.
        /// </summary>
        /// <param name="team">The team.</param>
        /// <returns></returns>
        public static bool EditTeam(Team team)
        {
            return Dao.EditTeam(team);
        }

        /// <summary>
        /// Gets the team by id.
        /// </summary>
        /// <param name="teamId">The team id.</param>
        /// <returns></returns>
        public static Team GetTeamById(int teamId)
        {
            return Dao.GetTeamById(teamId);
        }

        /// <summary>
        /// Sets the team status.
        /// </summary>
        /// <param name="teamId">The team id.</param>
        /// <param name="status">if set to <c>true</c> [status].</param>
        public static void SetTeamStatus(int teamId, bool status)
        {
            Dao.SetTeamStatus(teamId, status);
        }
    }
}